package uk.ac.ebi.curtain.exec;

import java.io.File;

import uk.ac.ebi.curtain.utils.data.FileType;
import uk.ac.ebi.curtain.utils.data.ReadType;
import uk.ac.ebi.curtain.utils.file.FileInfo;
import uk.ac.ebi.curtain.utils.file.Scaffold2ContigProcessor;
import uk.co.flamingpenguin.jewel.cli.ArgumentValidationException;
import uk.co.flamingpenguin.jewel.cli.CliFactory;
import uk.co.flamingpenguin.jewel.cli.Option;

/**
 * File: Scaffold2ContigSplitter.java
 * Created by: mhaimel
 * Created on: Sep 21, 2010
 * CVS:  $Id: Scaffold2ContigSplitter.java 1.0 Sep 21, 2010 3:07:26 PM mhaimel Exp $
 */

/**
 * @author mhaimel
 *
 */
public class Scaffold2ContigSplitter {
	
	private static interface S2CScope {
		
		@Option(shortName = "t", defaultValue="fasta", description="Input file type, default: fasta")
		public FileType getFileType();
		
		public boolean isFileType();

		@Option(shortName = "i",description="Input file")
		public File getInputFile();

		@Option(shortName = "o",description="Output file")
		public File getOutputFile();

		@Option(shortName = "g",description="Maximum Config Gap", defaultValue="0")
		public Integer getMaxContigGap();
		
		@Option(helpRequest = true, description = "display helpfull menu", shortName = "h")
		boolean getHelp();
	}
	
	public static void main(String[] args) {
		S2CScope param = null;
		try {
			param = CliFactory.parseArguments(S2CScope.class, args);
		} catch (ArgumentValidationException e1) {
			System.err.println(e1.getMessage());
			System.exit(1);
		}
		

		FileInfo in = new FileInfo(param.getInputFile(), param.getFileType(), ReadType.Contig);
		FileInfo out = new FileInfo(param.getOutputFile(), param.getFileType(), ReadType.Contig);
		
		Scaffold2ContigProcessor processor = new Scaffold2ContigProcessor();
		processor.setMaxContigGap(param.getMaxContigGap());
		processor.process(in,out);
	}
}
